package com.example.myapplication.values;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;

import androidx.annotation.Nullable;

import com.example.myapplication.R;

public class VPI extends LinearLayout implements View.OnClickListener {
    private ITF inter;
    private int mCount;//总页面数量
    private int mCurrent;//当前页码
    public VPI(Context context,
               @Nullable AttributeSet attrs) {
        super(context, attrs);

    }
    public  void setCount(int count){
        mCount = count;
    }
    public void setCurrent(int curr){
        removeAllViews();
        for (int i = 0 ;i < mCount ; ++i) {
            ImageView circle = new ImageView(getContext());
            if (curr == i)
            circle.setImageResource(R.drawable.on);
            else
                circle.setImageResource(R.drawable.off);
            circle.setPadding(5,0,5,0);
            addView(circle);

            circle.setTag(circle);
            circle.setOnClickListener(this);
        }
    }
    public void setInter.ITF{
        ITF

    }

    @Override
    public void onClick(View view) {
        Object viewTag = view.getTag();
        int VT = (int) viewTag;
        ITF

    }
}
